<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue-color-picker</title>
    <link rel="stylesheet" href="https://www.unpkg.com/ew-color-picker/dist/ew-color-picker.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .container {
            padding: 20px;
            background-color: #fff;
            position: absolute;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="container" :style="{ background:backgroundColor }">
            <div id="color-picker"></div>
        </div>
    </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="https://www.unpkg.com/ew-color-picker/dist/ew-color-picker.min.js"></script>
<script>
    new Vue({
        data() {
            return {
                colorPicker: null,
                backgroundColor: ""
            }
        },
        mounted() {
            const that = this;
            this.colorPicker = new ewColorPicker({
                el: "#color-picker",
                size: "mini",
                isLog: false,
                alpha: true,
                predefineColor: ["#fff", "#2396ef"],
                sure: that.handler,
                clear: that.handler
            })
        },
        methods: {
            handler(color) {
                this.backgroundColor = color;
            }
        }
    }).$mount("#app");
</script>

</html>